package com.octopus.tree;

import java.util.List;
import java.util.Properties;

import com.octopus.tree.imp.simple.AlreadyInTreeStructureException;
import com.octopus.tree.imp.simple.NameAlreadyExistException;

public interface TreeBranch {
	String getTreeBranchKind();
	String getTreeBranchName();
	Properties getTreeBranchProperties();
	String getTreeBranchProperty(String key);
	
	void setTreeBranchName(String name);
	void setTreeBranchKind(String kind);
	
	List<TreeLeaf> getTreeLeafList();
	List<TreeLeaf> getDefaultTreeLeafList();
	TreeLeaf getDefaultTreeLeafByName(String name);
	List<TreeLeaf> getTreeLeafByName(String name);
	List<TreeLeaf> getTreeLeafByNameAndKind(String name, String kind);
	
	void setTreeBranchProperty(String key, String value);
	void removeTreeBranchProperty(String key);
	boolean addTreeLeaf(TreeLeaf treeLeaf) throws AlreadyInTreeStructureException, NameAlreadyExistException;
	void removeTreeLeaf(TreeLeaf treeLeaf);

	List<TreeBranch> getAllSubBranch();
	List<TreeBranch> getDefaultAllSubBranch();
	TreeBranch getDefaultSubTreeBrancByName(String name);
	List<TreeBranch> getSubTreeBranchListByName(String name);
	List<TreeBranch> getSubTreeBranchListByNameAndKind(String name, String kind);
	boolean addTreeBranch(TreeBranch treeBranch) throws NameAlreadyExistException, AlreadyInTreeStructureException;

	void removeTreeBranch(TreeBranch treeBranch);
	String genTreePath();
	String genParentPath();
	
	boolean preparePermanent();
	void clearPermanent();
	boolean toContentObject();
	
	TreeBranch createSimpleSubTreeBranch(String pathExp);
	void detach();
}
